package org.iogame;

import com.iohao.game.action.skeleton.ext.spring.ActionFactoryBeanForSpring;
import com.iohao.game.bolt.broker.client.external.config.ExternalGlobalConfig;
import com.iohao.game.simple.SimpleHelper;
import lombok.extern.slf4j.Slf4j;
import org.iogame.action.DemoSpringLogicServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.List;

@SpringBootApplication //本地开发测试时使用
@Slf4j
public class IoGameMain {
    public static void main(String[] args) {

        SpringApplication.run(IoGameMain.class,args);
        ExternalGlobalConfig.verifyIdentity = false;
        int port = 10100;
        var demoLogicServer = new DemoSpringLogicServer();
        SimpleHelper.run(port, List.of(demoLogicServer));
    }


    @Bean
    public ActionFactoryBeanForSpring actionFactoryBean() {
        // 将业务框架交给 spring 管理
        return ActionFactoryBeanForSpring.me();
    }
}